<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--
   Licensed to the Apache Software Foundation (ASF) under one or more
   contributor license agreements.  See the NOTICE file distributed with
   this work for additional information regarding copyright ownership.
   The ASF licenses this file to You under the Apache License, Version 2.0
   (the "License"); you may not use this file except in compliance with
   the License.  You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
-->

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>JMeter - User's Manual: Building a Test Plan</title>
</head>
<body bgcolor="#ffffff" text="#000000" link="#525D76">
<table border="0" cellspacing="0">
<tr>
<td colspan="2">
<a href="http://jakarta.apache.org"><img width="505" height="48" src="../../docs/images/jakarta-logo.gif" align="left" border="0"></a>
</td>
</tr>
</table>
<table border="0" cellspacing="4">
<tr><td>
<hr noshade size="1">
</td></tr>
<tr>
<td align="left" valign="top">
<table>
<tr>
<td bgcolor="#525D76">
<div align="right"><a href="index.html"><font size=-1 color="#ffffff" face="arial,helvetica,sanserif">Index</font></a></div>
</td>
<td bgcolor="#525D76">
<div align="right"><a href="test_plan.html"><font size=-1 color="#ffffff" face="arial,helvetica,sanserif">Next</font></a></div>
</td>
<td bgcolor="#525D76">
<div align="right"><a href="get-started.html"><font size=-1 color="#ffffff" face="arial,helvetica,sanserif">Prev</font></a></div>
</td>
</tr>
</table>
<br>
<table border="0" cellspacing="0" cellpadding="2" width="100%">
<tr><td bgcolor="#525D76">
<font color="#ffffff" face="arial,helvetica,sanserif">
<a name="$section.getAttributeValue("anchor")"><strong>3. Building a Test Plan</strong></a>
</font>
</td></tr>
<tr><td>
<blockquote>
<p>
A test plan describes a series of steps JMeter will execute when run.  A complete
test plan will consist of one or more Thread Groups, logic conrollers, sample generating
controllers, listeners, timers, assertions, and configuration elements.

</p>
<table border="0" cellspacing="0" cellpadding="2" width="100%">
<tr><td bgcolor="#828DA6">
<font color="#ffffff" face="arial,helvetica,sanserif">
<a name="add_remove"><strong>3.1 Adding and Removing Elements</strong></a>
</font>
</td></tr>
<tr><td>
<blockquote>
<p>
Adding 
<a href="test_plan.html">
elements to a test plan
</a>
 can be done by right-clicking on an element in the
tree, and choosing a new element from the "add" list.  Alternatively, elements can
be loaded from file and added by choosing the "open" option.  
</p>
<p>
To remove an element, make sure the element is selected, right-click on the element,
and choose the "remove" option.
</p>
</blockquote>
</td></tr>
<tr><td><br></td></tr>
</table>
<table border="0" cellspacing="0" cellpadding="2" width="100%">
<tr><td bgcolor="#828DA6">
<font color="#ffffff" face="arial,helvetica,sanserif">
<a name="load_save"><strong>3.2 Loading and Saving Elements</strong></a>
</font>
</td></tr>
<tr><td>
<blockquote>
<p>
To load an element from file, right click on the existing tree element to which
you want to add the loaded element, and select the "open" option.  Choose the file where
your elements are saved.  JMeter will load the elements into the tree.
</p>
<p>
To save tree elements, right click on an element and choose the "save" option.
JMeter will save the element selected, plus all child elements beneath it.  In this way,
you can save test tree fragments, individual elements, or the entire test plan.
</p>
<p><table border="1" bgcolor="#bbbb00" width="50%" cellspacing="0" cellpadding="2">
<tr><td>The workbench is not automatically saved with the test plan, but it can be saved separately as above.
</td></tr>
</table></p>
</blockquote>
</td></tr>
<tr><td><br></td></tr>
</table>
<table border="0" cellspacing="0" cellpadding="2" width="100%">
<tr><td bgcolor="#828DA6">
<font color="#ffffff" face="arial,helvetica,sanserif">
<a name="config_element"><strong>3.3 Configuring Tree Elements</strong></a>
</font>
</td></tr>
<tr><td>
<blockquote>
<p>
Any element in the test tree will present controls in JMeter's right-hand frame.  These
controls allow you to configure the behavior of that particular test element.  What can be
configured for an element depends on what type of element it is.
</p>
<p><table border="1" bgcolor="#bbbb00" width="50%" cellspacing="0" cellpadding="2">
<tr><td>The Test Tree itself can be manipulated by dragging and dropping components around the test tree.
</td></tr>
</table></p>
</blockquote>
</td></tr>
<tr><td><br></td></tr>
</table>
<table border="0" cellspacing="0" cellpadding="2" width="100%">
<tr><td bgcolor="#828DA6">
<font color="#ffffff" face="arial,helvetica,sanserif">
<a name="saving"><strong>3.4 Saving the Test Plan</strong></a>
</font>
</td></tr>
<tr><td>
<blockquote>
<p>
Although it is not required, we recommend that you save the Test Plan to a
file before running it.  To save the Test Plan, select Save Test Plan from the
File menu (with the latest release, it is no longer necessary to select the
Test Plan element first).
</p>
<p><table border="1" bgcolor="#bbbb00" width="50%" cellspacing="0" cellpadding="2">
<tr><td>JMeter allows you to save the entire Test Plan tree or
only a portion of it.  To save only the elements located in a particular "branch"
of the Test Plan tree, select the Test Plan element in the tree from which to start
the "branch", and then click your right mouse button to access the Save As menu item.
Alternatively, select the appropriate Test Plan element  and then select Save As from
the Edit menu.

</td></tr>
</table></p>
</blockquote>
</td></tr>
<tr><td><br></td></tr>
</table>
<table border="0" cellspacing="0" cellpadding="2" width="100%">
<tr><td bgcolor="#828DA6">
<font color="#ffffff" face="arial,helvetica,sanserif">
<a name="run"><strong>3.5 Running a Test Plan</strong></a>
</font>
</td></tr>
<tr><td>
<blockquote>
<p>
To run your test plan, choose "start" from the "run" menu item.  To stop your test
plan, choose "stop" from the same menu.  
When JMeter is running, it shows a small green box at the right hand end of the section just under the menu bar.
You can also check the "run" menu.  
If "start" is disabled, and "stop" is enabled,
then JMeter is running your test plan (or, at least, it thinks it is).
</p>
<p>

There are two types of stop command:

<ul>


<li>
Stop (Control + '.') - stops the threads immediately
</li>


<li>
Shutdown (Control + ',')- requests the threads to stop at the end of any current work
</li>


</ul>


</p>
</blockquote>
</td></tr>
<tr><td><br></td></tr>
</table>
<table border="0" cellspacing="0" cellpadding="2" width="100%">
<tr><td bgcolor="#828DA6">
<font color="#ffffff" face="arial,helvetica,sanserif">
<a name="scoping_rules"><strong>3.6 Scoping Rules</strong></a>
</font>
</td></tr>
<tr><td>
<blockquote>
<p>

The JMeter test tree contains elements that are both hierarchical and ordered.  Some elements in the test trees are strictly hierarchical (Listeners, Config Elements, Post-Procesors, Pre-Processors, Assertions, Timers), and some are primarily ordered (controllers, samplers).  When you create your test plan, you will create an ordered list of sample request (via Samplers) that represent a set of steps to be executed.  These requests are often organized within controllers that are also ordered.  Given the following test tree:
</p>
<p><table border="0" cellspacing="0" cellpadding="0"><tr><td><img  src="../../docs/images/screenshots/scoping1.png"><br>
<font size="-1">Example test tree
</font></td></tr></table></p>
<p>
The order of requests will be, One, Two, Three, Four.
</p>
<p>
Some controllers affect the order of their subelements, and you can read about these specific controllers in 
<a href="component_reference.html">
the component reference
</a>
.
</p>
<p>
Other elements are hierarchical.  An Assertion, for instance, is hierarchical in the test tree.  
If its parent is a request, then it is applied to that request. If its
parent is a Controller, then it affects all requests that are descendants of
that Controller.  In the following test tree:
</p>
<p><table border="0" cellspacing="0" cellpadding="0"><tr><td><img  src="../../docs/images/screenshots/scoping2.png"><br>
<font size="-1">Hierarchy example
</font></td></tr></table></p>
<p>
Assertion #1 is applied only to Request One, while Assertion #2 is applied to Requests Two and Three.
</p>
<p>
Another example, this time using Timers:
</p>
<p><table border="0" cellspacing="0" cellpadding="0"><tr><td><img  src="../../docs/images/screenshots/scoping3.png"><br>
<font size="-1">complex example
</font></td></tr></table></p>
<p>
In this example, the requests are named to reflect the order in which they will be executed.  Timer #1 will apply to Requests Two, Three, and Four (notice how order is irrelevant for hierarchical elements).  Assertion #1 will apply only to Request Three.  Timer #2 will affect all the requests.
</p>
<p>
Hopefully these examples make it clear how configuration (hierarchical) elements are applied.  If you imagine each Request being passed up the tree branches, to its parent, then to its parent's parent, etc, and each time collecting all the configuration elements of that parent, then you will see how it works.  
</p>
<b>

The Configuration elements Header Manager, Cookie Manager and Authorization manager are
treated differently from the Configuration Default elements.
The settings from the Configuration Default elements are merged into a set of values that the Sampler has access to.
However, the settings from the Managers are not merged.
If more than one Manager is in the scope of a Sampler, 
only one Manager is used, but there is currently no way to specify 
<b>
which
</b>
 is used.

</b>
</blockquote>
</td></tr>
<tr><td><br></td></tr>
</table>
<table border="0" cellspacing="0" cellpadding="2" width="100%">
<tr><td bgcolor="#828DA6">
<font color="#ffffff" face="arial,helvetica,sanserif">
<a name="error_reporting"><strong>3.7 Error reporting</strong></a>
</font>
</td></tr>
<tr><td>
<blockquote>
<p>

JMeter reports warnings and errors to the jmeter.log file, as well as some information on the test run itself.
Just occasionally there may be some errors that JMeter is unable to trap and log; these will appear on the command console.
If a test is not behaving as you expect, please check the log file in case any errors have been reported (e.g. perhaps a syntax error in a function call).

</p>
<p>

Sampling errors (e.g. HTTP 404 - file not found) are not normally reported in the log file. 
Instead these are stored as attributes of the sample result.
The status of a sample result can be seen in the various different Listeners.

</p>
</blockquote>
</td></tr>
<tr><td><br></td></tr>
</table>
</blockquote>
</p>
</td></tr>
<tr><td><br></td></tr>
</table>
<br>
<table>
<tr>
<td bgcolor="#525D76">
<div align="right"><a href="index.html"><font size=-1 color="#ffffff" face="arial,helvetica,sanserif">Index</font></a></div>
</td>
<td bgcolor="#525D76">
<div align="right"><a href="test_plan.html"><font size=-1 color="#ffffff" face="arial,helvetica,sanserif">Next</font></a></div>
</td>
<td bgcolor="#525D76">
<div align="right"><a href="get-started.html"><font size=-1 color="#ffffff" face="arial,helvetica,sanserif">Prev</font></a></div>
</td>
</tr>
</table>
</td>
</tr>
<tr><td>
<hr noshade size="1">
</td></tr>
<tr>
<td>
<table width=100%>
<tr>
<td>
<font color="#525D76" size="-1"><em>
Copyright &copy; 1999-2008, Apache Software Foundation
</em></font>
</td>
<td align="right">
<font color="#525D76" size="-1"><em>
Updated: $Date: 2008-03-01 16:18:09 +0000 (Sat, 01 Mar 2008) $
</em></font>
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>




























